package cn.corgy.coherence;

import java.util.SortedMap;
import java.util.TreeMap;

public class Coherence {
    public static void main(String[] args) {
        TreeMap<Long, String> map = new TreeMap<>();
        map.put(111L, "127.0.0.1");
        map.put(222L, "127.0.0.2");
        map.put(333L, "127.0.0.3");
        map.put(444L, "127.0.0.4");
        SortedMap<Long, String> maps = map.tailMap(201L);
        if (maps.isEmpty()) {
            System.out.println(map.firstEntry().getValue());
        } else {
            System.out.println(maps.get(maps.firstKey()));
        }
    }
}
